< previous page page_292 next page >

Page 292
z0312-01.gif
Figure 10.11
Frames produced by program FlakeAn1.
Next, the program pulls the midpoints of the level-one snowflake edges outward until they lie in their proper positions for a level-two snowflake. The program continues this process until it has created the complete snowflake.
When you specify higher levels for the snowflakes, the program takes longer to draw each frame. For that reason, the animation starts to slow down when the maximum level drawn is around three or four. The snowflake does not show much detail beyond level four anyway, so you really do not need to animate higher levels.
Example program FlakeAn2 animates snowflakes in a different way. For each frame, the program displays a snowflake of the level specified in the Level text box. It starts by making the initial angle in the generator zero. This makes the snowflake look like a triangle no matter what level you specify. The program then gradually increases the angles in the generator, displaying a new frame for each angle.
As is the case with program FlakeAn1, higher-level snowflakes take longer to display, so the animation starts to slow down when you specify a level above three or four. The reduced detail at these higher levels makes them uninteresting anyway.
Other Snowflakes
Using program Flake as a starting point, you can make other snowflake programs that use different initiators and generators. The initiators are usually regular polygons like triangles, squares, or hexagons. The points in the generators are usually selected to fall on the points of a lattice made up of regular polygons.
For example, Figure 10.12 shows the generator and initiator for a Gosper curve. The initiator is a hexagon. The points in the generator fall on the points of a triangular lattice. Figure 10.13 shows some of the snowflakes produced by this initiator and generator.
Example program Flake2 lets you load a file with a .sno extension that describes a snowflake's initiator and generator. These files have a format similar to the following file, which describes a von Koch snowflake. The comments to the right make the listing easier to follow and are not part of the file.

 
< previous page page_292 next page >